<template>
  <div class="animated fadeIn">
    <div class="row">
      <div class="col-md-12">
        <b-card>
          <div slot="header">
            <strong>咨询信息详情</strong>
          </div>

          <b-form-fieldset label="姓名：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="name"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="公司名称：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="companyName"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="部门名称：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="deptName"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="邮政编码：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="postcode"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="地址：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="address"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="电话：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="tel"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="传真：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="fax"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="E-mail：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="email"></b-form-input>
          </b-form-fieldset>
          <b-form-fieldset label="意见、咨询：" :label-cols="2" :horizontal="true">
            <textarea class="form-control" :rows="5" :disabled="true"  placeholder="" v-model="consult">{{ consult }}</textarea>
          </b-form-fieldset>
          <b-form-fieldset label="时间：" :label-cols="2" :horizontal="true">
            <b-form-input type="text" :disabled="true" placeholder="" v-model="createdate"></b-form-input>
          </b-form-fieldset>
          <div slot="footer">
            <b-button type="submit" size="sm" variant="primary" @click="backConsult()">
              <i class="fa fa-dot-circle-o"></i> 返回
            </b-button>
          </div>
        </b-card>
      </div>
    </div>
  </div>
</template>

<script>
  import { findCompanyById } from '../../service/api'
  export default {
    name: 'forms',
    data () {
      return {
        name: '',
        companyName: '',
        deptName: '',
        postcode: '',
        address: '',
        tel: '',
        fax: '',
        email: '',
        consult: '',
        createdate: ''
      }
    },
    methods: {
      backConsult () {
        this.$router.push({
          path: '/information/consult'
        })
      }
    },
    created () {
      // console.log('did : ' + this.$route.query.id)
      findCompanyById({id: this.$route.query.id})
        .then(({ data, err }) => {
          console.log('err: ' + err)
          console.log('data: ' + data)
          if (data.code === 200) {
            // console.log(data.result)
            this.name = data.result.name
            this.companyName = data.result.companyName
            this.deptName = data.result.deptName
            this.postcode = data.result.postcode
            this.address = data.result.address
            this.tel = data.result.tel
            this.fax = data.result.fax
            this.email = data.result.email
            this.consult = data.result.consult
            this.createdate = data.result.createdate
          }
        })
    }
  }
</script>
